﻿using OneDark.Update;
using System;
using System.Globalization;
using System.Windows.Data;
using System.Windows.Media.Imaging;

namespace OneDark.Converters
{
    public class GitChange2Icon : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            RepoStatus status = (RepoStatus)value;
            string strIconPath;
            switch (status)
            {
                case RepoStatus.Conflict:
                    strIconPath = "Resource/ModifiedIcon.ico";
                    break;

                case RepoStatus.Conflict_Update:
                    strIconPath = "Resource/ConflictIcon.ico";
                    break;

                case RepoStatus.Repeat:
                    strIconPath = "Resource/IgnoredIcon.ico";
                    break;

                case RepoStatus.Unversioned:
                    strIconPath = "Resource/UnversionedIcon.ico";
                    break;

                case RepoStatus.RemotedDeleted:
                    strIconPath = "Resource/DeletedIcon.ico";
                    break;

                default:
                    strIconPath = "Resource/NormalIcon.ico";
                    break;
            }

            Uri uri = new Uri(strIconPath, UriKind.Relative);
            BitmapImage image = new BitmapImage(uri);
            return image;
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
}